<template>
    <div class="main">
        <div class="tree-menu">
            <ul v-for="menuItem in theModel">
                <my-tree :model="menuItem"></my-tree>
            </ul>
        </div>

    </div>

</template>

<script>
import myTree from './treemenu'
import { companyList2 } from '@/api/api'
import { XHeader, Tabbar, TabbarItem, Group, Cell } from 'vux'
export default {
    name: 'App',
    data () {
        return {
            theModel: []
        }
    },
    components: {
        Tabbar,
        TabbarItem,
        Group,
        Cell,
        XHeader,
        myTree
    },
    created () {
        this.getCompany(this.$route.query.departId)
    },
    methods: {
        getCompany (departId) {
            // let xhr = new XMLHttpRequest();
            // xhr.open("post","/nzcgjsms/api/AppService.ashx");

            // xhr.send({"data":{"allowPaging": true,"business": "GetHdProjects","data": "393498467","pageIndex": 0,"pageSize": 20,"tokenId": "BECC40369A4E48CBD726FED2AE61CDDA","userId": "-1160409415"}});

            // xhr.onreadystatechange = function(){
            //     if(xhr==200){
            //        console.log(xhr.response)
            //     }
            // }
            let param = {
                data: departId
            }
            companyList2(param).then(
                (res) => {
                    console.log(res.data[0])
                    this.theModel = res.data
                }
            )
        }
    }

}
</script>

<style scoped lang="less">
</style>
